package cn.mihoyo.org.dto;

import cn.mihoyo.org.domain.Shop;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.util.Date;

@Data
public class ShopDto {

    @NotBlank(message = "店铺名称不为空！")
    private String name;
    @NotBlank(message = "店铺座机不为空！")
    private String tel;
    @NotBlank(message = "店铺地址不为空！")
    private String address;
    private String logo;

    @Valid
    private AdminDto admin;

    public Shop getShop(){
        return Shop
                .builder()
                .name(this.name)
                .tel(this.tel)
                .registerTime(new Date())
                .state(0)
                .address(this.address)
                .logo(this.logo)
                .build();
    }
}
